{extend name="public/help" /}
{block name="oneMenuName"}{$crumbs['oneMenuName']}{/block}
{block name="twoMenuName"}{$crumbs['twoMenuName']}{/block}
{block name="body"}
<div class="main-content">
    <div class="row">
        <div class="col-lg-6">
            <div class="card alert">
                <div class="card-header">
                    <h4>搜索</h4>
                </div>
                <div class="card-body">
                    <div class="basic-form">
                        <form>
                            <div class="form-group">
                                <div class="input-group input-group-default">
                                    <span class="input-group-btn">
                                        <button class="btn btn-primary" type="submit">
                                            <i class="ti-search"></i>
                                        </button>
                                    </span>
                                    <select class="form-control" name="search">
                                        <option value="">-- 全部 --</option>
                                        {volist name="business" id="vo"}
                                        <option value="{$vo.id}"
                                                {eq name="$vo.id" value=":input('search')"}selected{/eq}
                                        >{$vo.name}</option>
                                        {/volist}
                                    </select>
                                </div>
                            </div>
                        </form>

                    </div>

                </div>

                <div class="card alert">
                    <div class="card-header">
                        <h4>用户列表</h4>
                    </div>
                    <div class="card-body">
                        <table class="table table-responsive table-bordered">
                            <thead>
                            <tr>
                                <th>商家名称</th>
                                <th>待放款金额</th>
                                <th>申请时间</th>
                                <th>放款时间</th>
                                <th>状态</th>
                                <th>操作</th>

                            </tr>
                            </thead>
                            <tbody>
                            {foreach $data as $k => $v}
                            <tr>
                                <td scope="row">{$v.b_name}</td>
                                <td scope="row">{$v.price}</td>
                                <td scope="row">
                                    {if $v.create_time != 0}
                                    {$v.create_time|date="Y-m-d H:i:s",###}
                                    {/if}
                                </td>
                                <td scope="row">
                                    {if $v.put_time != 0}
                                    {$v.put_time|date="Y-m-d H:i:s",###}
                                    {/if}
                                </td>
                                <td scope="row">
                                    {if $v.status == 1}
                                        待放款
                                    {else}
                                        已放款
                                    {/if}
                                </td>
                                <td scope="row">
                                    {if $v.status == 1}
                                    <a href="javascript:;" class="put_withdrawal" ids="{$v.id}">
                                        <button type="button" class="btn btn-info m-b-10 m-l-3">审核通过(放款)</button>
                                    </a>
                                    {/if}
                                </td>
                            </tr>
                            {/foreach}
                            </tbody>
                        </table>
                        {$data->render()}
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

{/block}
{block name="js"}
<script>
    $('.put_withdrawal').click(function () {
        var id = $(this).attr('ids');
        if(!id) {error('参数有误');return;}

        layer.confirm('确定放款吗？', {btn: ['放款','取消']}, function(){
            var url = "{:url('/admin/putWithdrawal')}";
            var datas = {
                id : id
            };

            $.ajax({
                type : 'post',
                url : url,
                data : datas,
                success : function(res){
                    if(res.code){
                        reload_success(res.msg);
                    }else{
                        error(res.msg);
                    }
                }
            });
        });
    });
</script>
{/block}

